/**
 * 首页模块路由
 * 
 * 
 */
import Home from '@/views/background/home'
import First from '@/views/background/first'
import goodsRoutes from "./goods"
import retailRoutes from './retail'
import purchaseRoutes from './purchase'
import stockRoutes from './stock'
import memberRoutes from './member'
import promotionRoutes from './promotion'
import store from '@/store'
export default [{
    path: "/home",
    component: Home,
    redirect: "/home/first",
    // 路由守卫
    beforeEnter: (to, from, next) => {
        let token = store.state.common._token
        next()
        if (token) {
            console.log('登陆过了')
            next()
        } else {
            console.log('还没登陆')
            next('/')
        }
    },
    children: [
        ...goodsRoutes,
        ...retailRoutes,
        ...purchaseRoutes,
        ...stockRoutes,
        ...memberRoutes,
        ...promotionRoutes,
        {
            path: "first",
            component: First
        }
    ]
}]